package com.learning.hadoop.mapreduce.weather;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * ClassName: GroupHot
 * Description:自定义分组,只需要按年份分组
 * Date: 2018/3/25 21:58 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class GroupHot extends WritableComparator {

    public GroupHot() {
        super(KeyPari.class, true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        KeyPari o1 = (KeyPari) a;
        KeyPari o2 = (KeyPari) b;
        return Integer.compare(o1.getYear(), o2.getYear());
    }
}
